//
//  DSZSwitchTableViewCell.m
//  7.13苏宁框架
//
//  Created by app05 on 15/7/29.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZSwitchTableViewCell.h"

@interface DSZSwitchTableViewCell ()

@property(nonatomic,copy)NSString *isOn;

@end
@implementation DSZSwitchTableViewCell

+(id)cell
{
    return [[NSBundle mainBundle]loadNibNamed:@"DSZSwitchTableViewCell" owner:nil options:nil][0];
}
-(void)awakeFromNib
{
    
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *str =[defaults objectForKey:@"switch"];
    if ([str isEqualToString:@"on"]) {
        self.swithOutlet.on=YES;
    }
    else
        self.swithOutlet.on=NO;

    
   
}

- (IBAction)switchOn:(UISwitch *)sender {
    
    NSString *str=nil;
    if (sender.on)
    {
        str=@"on";
    }
    else
    {
        str=@"";
    }
    // 存储数据
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    
    [defaults setObject:str forKey:@"switch"];
    //[defaults setObject:@"" forKey:@"mm"];
    [defaults synchronize];
}
@end
